Skip to content

fix(aggregator): top-level error boundary, per-facet fail-soft, consistent 404s (#1211) - #3985

Merged
dezren39 merged 1 commit into
mainfrom
queue/4920-1211-aggregator-errors
Nov 1, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/4920-1211-aggregator-errors

Conversation

@dezren39

@dezren39 dezren39 commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

Implements issue #1211 (queue task 4920), the three triage-confirmed gaps in pm-stack/aggregator/src/server.ts:

1. Top-level error boundary — fetchHandler now catches a throwing handler: page routes get a styled 500 page, /api routes get JSON 500, and the render-health record still runs (accounting the failure as an unsuccessful render) instead of the fetch rejecting. Response construction lives in the new src/error-boundary.ts (state-free, unit-testable — the path-segment.ts precedent).

2. Per-facet fail-soft — the unguarded aggregate contexts now catch per facet, mirroring the existing guarded /program route: boardContext (board/items), roadmapContext (roadmap/items), attentionContext (attention/orchestration/coverage), todayContext + overviewContext (quota/orchestration), the /quota page and /quota/service (usage), and the /item lookup (board/roadmap/items/comments). Fallbacks are the honest empty forms (emptyQuotaView() / emptyUsageView() / [] / null), so renderers banner absent data (e.g. the tier-source-missing flag) instead of the whole page 500ing.

3. Consistent not-found — /item/<miss> and /quota/service/<miss> now return their styled HTML at status 404 (were 200); the unknown-path fallthrough uses notFoundResponse: styled HTML 404 for page routes, JSON 404 for /api. Existing explicit-404 routes unchanged.

Tests — new test/error-boundary-1211.test.ts: unit tests for the boundary/not-found responses + boot tests (fixtures) for the 404 semantics, known pages still 200, and the degraded attention render. Laptop results: new file 6/6 pass, boot.test.ts 11/11 pass, full aggregator suite 920 pass / 1 fail — the one failure (slice3 > dns + sessions + pages routes serve, registry records) fails identically on clean main in this environment (pre-existing, unrelated). tsc --noEmit: exactly the same 12 pre-existing errors as clean main, none in the changed files.

One acceptance nuance: "a stub source that throws per-facet" cannot be boot-injected today — server.ts picks its Source at module level with no test seam, and I did not add a production seam for tests. The fail-soft half is therefore covered by construction (same .catch pattern as /program) + the degraded-render boot assertion; the boundary half is unit- and response-tested. Happy to add a stub-source seam as a follow-up if wanted.

🤖 Queue worker (repo-worker-code), lane A — task 4920


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

@dezren39
dezren39 requested a review from a team as a code owner November 1, 2026 21:10
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-01T21:12:22.185805Z 460ba4b PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Nov 1, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 57 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 7c8dcc77-7357-4e0f-b8a6-6b2596100e71
Commits

Reviewing files that changed from the base of the PR and between 70a595a and 460ba4b.

Files selected for processing: 3
  • pm-stack/aggregator/src/error-boundary.ts
  • pm-stack/aggregator/src/server.ts
  • pm-stack/aggregator/test/error-boundary-1211.test.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@dezren39
dezren39 merged commit 3acea07 into main Nov 1, 2026
1 check passed
@dezren39
dezren39 deleted the queue/4920-1211-aggregator-errors branch November 1, 2026 21:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant